<template>
  <div class="spotCheck h100">
    <iframe
      class="reports__iframe"
      id="workflow"
      name="myFrame"
      frameborder="0"
      width="100%"
      height="100%"
      ref="iframe"
      :src="iframeUrl"
    ></iframe>
  </div>
</template>
<script>
import {
  getAddressPre,
  getAddressAfter,
} from "@/api/operationManagement/runStatistical.js";
export default {
  data() {
    return {
      iframeUrl: "",
    };
  },
  created() {
    this.init();
  },
  mounted() {},
  methods: {
    init() {
      this.getAddress();
    },
    getAddress() {
      getAddressPre()
        .then((res) => {
          if (res.code == 200) {
            this.urlPre = res.data;
            this.getAfterAddress();
          }
        })
        .catch((err) => {
          this.$message.error(err.description);
        });
    },
    getAfterAddress() {
      let param = {
        classifyCode: "operation",
        code: "startSuccessRatio",
      };
      getAddressAfter(param)
        .then((res) => {
          if (res.code == 200) {
            let currentData = res.data.configDetailList.find((item) => {
              return item.appid == this.$store.getters.currentAppInfo.appId;
            });
            this.iframeUrl = this.urlPre + currentData.value;
          }
        })
        .catch((err) => {
          this.$message.error(err.description);
        });
    },
  },
};
</script>
<style lang="less" scoped>
.spotCheck {
  height: 100%;
  .reports__iframe {
    height: 100%;
    min-height: 400px;
  }
}
</style>